#ifndef __WAVTRACK_H__
#define __WAVTRACK_H__

#include "track.h"
#include "wavchunks.h"
#include "ctnode.h"
#include "stream.h"
#include "wavstream.h"

#define WAVTRACK_CAST(x) ((WavTrack *)(x))

typedef struct _WavTrack
{
  Track track;

  WavChunk *beat;
  FmtChunk *beat_format_chunk;
  DataChunk *beat_data_chunk;
  WavStream wav_stream;
} WavTrack;

void wavtrack_create (WavTrack *track, WavChunk *bead_wav, Stream *out_stream);

/* Track callbacks */
static void wavtrack_process_node (Track *track, CTNode *node);
static void wavtrack_finalize (Track *track);

static void wavtrack_write_measures (WavTrack *track, int nmeasures);
static void wavtrack_write_beat_to_stream (WavTrack *track, Stream *stream,
                                           int vol);

#endif
